import React, { Component } from 'react';
import { Route, Switch , Redirect} from 'react-router-dom'
class Rotuerview extends Component {
	render() {
		const { routes } = this.props
		return (
			<Switch>
				{
					routes.length > 0 && routes.map((v, i) => {
						return (
							v.path 
								? <Route key={ i } path={ v.path }
									render={ props => <v.component { ...props } routes={ v.children }></v.component> }
								></Route>
								: <Redirect key={ i } { ...v }></Redirect>
						)
					})
				}
			</Switch>
		);
	}
}

export default Rotuerview;
